﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SanPhamDetails.ascx.cs" Inherits="UserControl_SanPhamDetails" %>
<link href="Css/jquery.lightbox-0.5.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery.lightbox-0.5.js" type="text/javascript"></script>
  <script type="text/javascript">
      $(function () {
          $('#galleryBox a').lightBox();
      });

</script>


 <div id="galleryBox">
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
    DataKeyNames="MaSanPham" DataSourceID="SqlDataSourceSanPhamDetails" 
    EnableModelValidation="True" Height="50px" Width="100%" BorderWidth="0px" 
    GridLines="None">
    <Fields>
        <asp:TemplateField>
            <ItemTemplate>
                <table width="100%">
                    <tr>
                        <td  colspan="3">
                         <div ID="page-main-content-title" class="style1" style="outline: 0;">
            &nbsp;<asp:Label ID="lblTitle" runat="server" CssClass="title-item" 
                Text='<%# Eval("MaSanPham") %>'></asp:Label>
        </div>
                        
                        </td>
                    </tr>
                    <tr>
                        <td align="center" width="130px">
                       
                            <asp:DetailsView ID="DetailsView2" runat="server" AutoGenerateRows="False" 
                                DataKeyNames="ID" DataSourceID="SqlDataSourceHinhAnh" 
                                EnableModelValidation="True" Height="50px" Width="125px" BorderWidth="0px" 
                                GridLines="None">
                                <Fields>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                        
                                            <div align="center" style="text-align: center">
                                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("URL") %>' >
                                                <asp:Image ID="Image1" runat="server" AlternateText='<%# Eval("MaSanPham") %>' 
                                                    BorderColor="#3399FF" BorderStyle="Dotted" BorderWidth="1px" Height="220px" 
                                                    ImageUrl='<%# Eval("URL") %>' Width="220px" ToolTip="Click để xem nhiều ảnh hơn"/>
                                                    Xem ảnh lớn
                                                    </asp:HyperLink>
                                                <br />
                                                <br />
                                                <%--<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# Eval("URL") %>'>Xem thêm ảnh</asp:HyperLink>--%>
                                            </div>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Fields>
                            </asp:DetailsView>
                            <asp:SqlDataSource ID="SqlDataSourceHinhAnh" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:KinhMatConnecString %>" 
                                SelectCommand="SELECT * FROM [HinhAnh] WHERE ([MaSanPham] = @MaSanPham)">
                                <SelectParameters>
                                    <asp:QueryStringParameter Name="MaSanPham" QueryStringField="id" 
                                        Type="String" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                           
                        </td>
                        <td align="left"
                            style="vertical-align: top; padding-right: 25px;" valign="top" 
                            width="20px">
                            &nbsp;</td>
                        <td style="vertical-align: top; text-align: left">
                            MÃ SP:
                            <asp:Label ID="lblMaSP" runat="server" Font-Bold="True" Font-Size="Large" 
                                ForeColor="#666666" Text='<%# Eval("MaSanPham") %>'></asp:Label>
                            <br />
                            Sản phẩm:
                            <asp:Label ID="lblNhanhieu" runat="server" ForeColor="Gray" 
                                Text='<%# Eval("tenTH") %>'></asp:Label>
                            <br />
                            Loại :
                            <asp:Label ID="lblLoai" runat="server" ForeColor="Gray" 
                                Text='<%# Eval("TenLoai") %>'></asp:Label>
                            <br />
                            <asp:Label ID="lblGia" runat="server" Font-Bold="False" Font-Italic="False" 
                                ForeColor="#FF6600" Text='<%# Eval("GiaBan", "Giá: {0:N0}VNĐ") %>'></asp:Label>
                            <hr style="border: thin solid #0099FF" />
                            <asp:ImageButton ID="ImageButton1" runat="server" 
                                ImageUrl="~/Image/addcart.png" CommandArgument='<%# Eval("MaSanPham") %>' 
                                CommandName="btnMuaHang" onclick="ImageButton1_Click" />
                            <br />
                            <br />
                        </td>
                    </tr>
                    <tr>
                        <td align="left" valign="top" colspan="3">
                            <asp:Label ID="lblMota" runat="server" Text='<%# Eval("GioiThieu") %>'></asp:Label>
                            <br />
                        </td>
                    </tr>
                    <tr>
                        <td align="left" colspan="3" valign="top">
                            <asp:HiddenField ID="HiddenField1" runat="server" 
                                Value='<%# Eval("LoaiID") %>' />
                            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
                                
                                
                                
                                
                                SelectCommand="SELECT TOP (9) SanPham.MaSanPham, (SELECT TOP (1) URL FROM HinhAnh WHERE (MaSanPham = SanPham.MaSanPham)) AS hinhanh, SanPham.GiaBan, SanPham.LoaiID, SanPham.Xoa, SanPham.ChucNangID, SanPham.NhanHieuID, Loai.TenLoai FROM SanPham INNER JOIN Loai ON SanPham.LoaiID = Loai.ID INNER JOIN HinhAnh AS HinhAnh_1 ON SanPham.MaSanPham = HinhAnh_1.MaSanPham WHERE (Loai.ID = @id) AND (SanPham.MaSanPham &lt;&gt; @idsp) GROUP BY SanPham.MaSanPham, SanPham.GiaBan, SanPham.LoaiID, SanPham.Xoa, SanPham.ChucNangID, SanPham.NhanHieuID, Loai.TenLoai">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="HiddenField1" Name="id" PropertyName="Value" />
                                    <asp:QueryStringParameter Name="idsp" QueryStringField="ID" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                            
                             <div ID="page-main-content-title" class="style1" style="outline: 0;">
            &nbsp;<asp:Label ID="Label3" runat="server" CssClass="title-item" 
                Text='Sản phẩm cùng loại'></asp:Label>
        </div
                            
                            </td>
                    </tr>
                    <tr>
                        <td align="left" colspan="3" valign="top">

                            <asp:DataList ID="DataList1" runat="server" DataKeyField="MaSanPham" 
                                DataSourceID="SqlDataSource1" RepeatColumns="3" RepeatDirection="Horizontal" 
                                style="text-align: center">
                                <ItemTemplate>
                                    <div class="item">
                                        <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
                                            <tr>
                                                <td>
                                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                        <tr>
                                                            <td width="11">
                                                                <img height="11" src="image/tbl_pro1.jpg" width="11"></img></td>
                                                            <td background="image/tbl_pro2.jpg">
                                                                <img height="11" src="image/tbl_pro2.jpg" width="1"></img></td>
                                                            <td width="11">
                                                                <img height="11" src="image/tbl_pro3.jpg" width="11"></img></td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                        <tr>
                                                            <td style="background-image: url(image/tbl_pro4.jpg); background-repeat: repeat-y; background-position: left top" 
                                                                width="11">
                                                                &nbsp;</td>
                                                            <td>
                                                                <asp:Label ID="Label2" runat="server" 
                                                                    style="font-weight: 700; color: #999999; font-size: 14px" 
                                                                    Text='<%# Eval("MaSanPham") %>' />
                                                            </td>
                                                            <td style="background-image: url(image/tbl_pro5.jpg); background-repeat: repeat-y; background-position: right top" 
                                                                width="11">
                                                                &nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                            <td style="background-image: url(image/tbl_pro4.jpg); background-repeat: repeat-y; background-position: left top" 
                                                                width="11">
                                                                &nbsp;</td>
                                                            <td>
                                                                <div align="center">
                                                                    <asp:ImageButton ID="ImageButton2" runat="server" Height="220px" 
                                                                        ImageUrl='<%# Eval("HinhAnh") %>' 
                                                                        PostBackUrl='<%# "~/SanPham.aspx?ID="+Eval("MaSanPham") %>' 
                                                                        ToolTip="Click để xem chi tiết" Width="220px" />
                                                                </div>
                                                            </td>
                                                            <td style="background-image: url(image/tbl_pro5.jpg); background-repeat: repeat-y; background-position: right top" 
                                                                width="11">
                                                                &nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                            <td style="background-image: url(image/tbl_pro4.jpg); background-repeat: repeat-y; background-position: left top" 
                                                                width="11">
                                                                &nbsp;</td>
                                                            <td class="info" height="20">
                                                                <span class="style1" style="text-align: left">Thể loại : <span class="style1">
                                                                <asp:Label ID="Label13" runat="server" Text='<%# Eval("TenLoai") %>'></asp:Label>
                                                                </span>
                                                                <br />
                                                                </span>Giá :&nbsp;<asp:Label ID="Label15" runat="server" style="color: #FF0000" 
                                                                    Text='<%# Eval("GiaBan"," {0:N0} ") %>'></asp:Label>
                                                                &nbsp;VNĐ</td>
                                                            <td style="background-image: url(image/tbl_pro5.jpg); background-repeat: repeat-y; background-position: right top" 
                                                                width="11">
                                                                &nbsp;</td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                        <tr>
                                                            <td width="11">
                                                                <img height="36" src="image/tbl_pro6.jpg" width="11"></img></td>
                                                            <td background="image/tbl_pro7.jpg" style="padding-bottom:3px">
                                                                <div align="center">
                                                                    <table border="0" cellpadding="0" cellspacing="0">
                                                                    </table>
                                                                </div>
                                                            </td>
                                                            <td width="11">
                                                                <img height="36" src="image/tbl_pro8.jpg" width="11"></img></td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </ItemTemplate>
                            </asp:DataList>
                        </td>
                    </tr>
                </table>
            </ItemTemplate>
        </asp:TemplateField>
    </Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSourceSanPhamDetails" runat="server" 
    ConnectionString="<%$ ConnectionStrings:KinhMatConnecString %>" 
    
    
    SelectCommand="SELECT SanPham.MaSanPham, SanPham.GiaBan, SanPham.NgayCapNhat, SanPham.LoaiID, SanPham.Xoa AS Expr1, SanPham.GioiThieu, SanPham.ChucNangID, SanPham.NhanHieuID, Loai.TenLoai, NhanHieu.Ten AS tenTH, ChucNang.Ten AS tenCN FROM SanPham INNER JOIN Loai ON SanPham.LoaiID = Loai.ID INNER JOIN NhanHieu ON SanPham.NhanHieuID = NhanHieu.ID LEFT OUTER JOIN ChucNang ON SanPham.ChucNangID = ChucNang.ID WHERE (SanPham.MaSanPham = @MaSanPham)">
    <SelectParameters>
        <asp:QueryStringParameter Name="MaSanPham" QueryStringField="id" 
            Type="String" />
    </SelectParameters>
</asp:SqlDataSource>
     <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
 </div>
